Welcome Guest, you are in: Login

FDOT Wiki

RSS RSS

Navigation (FDOT Security STS)





Search the wiki
»

PoweredBy

Using Nancy: Bootstrapper

RSS
Modified on Monday, 21 December 2015 03:24 PM by 156.75.200.57 Categorized as Uncategorized
public class Bootstrapper : DefaultNancyBootstrapper
    {

        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
           
            pipelines.BeforeRequest += ctx =>
            {
                if (ctx.Request.Path == "/" && !System.Web.HttpContext.Current.Request.RawUrl.EndsWith("/"))
                    return new Nancy.Responses.RedirectResponse(ctx.Request.Url.ToString() + "/",
                        Nancy.Responses.RedirectResponse.RedirectType.Permanent);
                return null;
            };

            base.ApplicationStartup(container, pipelines);
            JsonSettings.MaxJsonLength = int.MaxValue;
            pipelines.EnableCORS();
        }

               
        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);
            StaticConfiguration.DisableErrorTraces = false;
            nancyConventions.MapStaticContent((file, dir) =>
            {
                dir["/dist"] = "/dist";
            });
        }
    }

ScrewTurn Wiki version 3.0.4.560. Some of the icons created by FamFamFam.